{
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "# Linear Regression with Nomalize Data"
      ],
      "metadata": {}
    },
    {
      "cell_type": "code",
      "source": [
        "import numpy as np\n",
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "import warnings\n",
        "warnings.filterwarnings(\"ignore\")\n",
        "\n",
        "# fix_yahoo_finance is used to fetch data \n",
        "import fix_yahoo_finance as yf\n",
        "yf.pdr_override()"
      ],
      "outputs": [],
      "execution_count": 1,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# input\n",
        "symbol = 'AMD'\n",
        "start = '2007-01-01'\n",
        "end = '2018-12-31'\n",
        "\n",
        "# Read data \n",
        "dataset = yf.download(symbol,start,end)\n",
        "\n",
        "# View Columns\n",
        "dataset.head()"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "[*********************100%***********************]  1 of 1 downloaded\n"
          ]
        },
        {
          "output_type": "execute_result",
          "execution_count": 2,
          "data": {
            "text/plain": [
              "                 Open       High        Low      Close  Adj Close    Volume\n",
              "Date                                                                       \n",
              "2007-01-03  20.080000  20.400000  19.350000  19.520000  19.520000  28350300\n",
              "2007-01-04  19.660000  19.860001  19.320000  19.790001  19.790001  23652500\n",
              "2007-01-05  19.540001  19.910000  19.540001  19.709999  19.709999  15902400\n",
              "2007-01-08  19.709999  19.860001  19.370001  19.469999  19.469999  15814800\n",
              "2007-01-09  19.450001  19.709999  19.370001  19.650000  19.650000  14494200"
            ],
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>Open</th>\n",
              "      <th>High</th>\n",
              "      <th>Low</th>\n",
              "      <th>Close</th>\n",
              "      <th>Adj Close</th>\n",
              "      <th>Volume</th>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>Date</th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "      <th></th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>2007-01-03</th>\n",
              "      <td>20.080000</td>\n",
              "      <td>20.400000</td>\n",
              "      <td>19.350000</td>\n",
              "      <td>19.520000</td>\n",
              "      <td>19.520000</td>\n",
              "      <td>28350300</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-04</th>\n",
              "      <td>19.660000</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>19.320000</td>\n",
              "      <td>19.790001</td>\n",
              "      <td>19.790001</td>\n",
              "      <td>23652500</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-05</th>\n",
              "      <td>19.540001</td>\n",
              "      <td>19.910000</td>\n",
              "      <td>19.540001</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>15902400</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-08</th>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.860001</td>\n",
              "      <td>19.370001</td>\n",
              "      <td>19.469999</td>\n",
              "      <td>19.469999</td>\n",
              "      <td>15814800</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2007-01-09</th>\n",
              "      <td>19.450001</td>\n",
              "      <td>19.709999</td>\n",
              "      <td>19.370001</td>\n",
              "      <td>19.650000</td>\n",
              "      <td>19.650000</td>\n",
              "      <td>14494200</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 2,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "X = dataset.iloc[ : , 1].values\n",
        "Y = dataset.iloc[ : , 4].values"
      ],
      "outputs": [],
      "execution_count": 3,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(X.shape)\n",
        "print(Y.shape)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "(3020,)\n",
            "(3020,)\n"
          ]
        }
      ],
      "execution_count": 4,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "X = np.array(X).reshape(3020,-1)\n",
        "Y = np.array(Y).reshape(3020,-1)"
      ],
      "outputs": [],
      "execution_count": 5,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn import preprocessing\n",
        "\n",
        "# normalize the data attributes\n",
        "normalized_X = preprocessing.normalize(X)"
      ],
      "outputs": [],
      "execution_count": 6,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# from sklearn.cross_validation import train_test_split\n",
        "from sklearn.model_selection import train_test_split\n",
        "X_train, X_test, Y_train, Y_test = train_test_split(normalized_X, Y, test_size = 1/4, random_state = 0) "
      ],
      "outputs": [],
      "execution_count": 7,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# from sklearn.cross_validation import train_test_split\n",
        "from sklearn.model_selection import train_test_split\n",
        "X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size = 1/4, random_state = 0) "
      ],
      "outputs": [],
      "execution_count": 8,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.linear_model import LinearRegression\n",
        "regressor = LinearRegression()\n",
        "regressor = regressor.fit(X_train, Y_train)"
      ],
      "outputs": [],
      "execution_count": 9,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "Y_pred = regressor.predict(X_test)"
      ],
      "outputs": [],
      "execution_count": 10,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "from sklearn.linear_model import LinearRegression\n",
        "regressor = LinearRegression()\n",
        "regressor = regressor.fit(X_train, Y_train)"
      ],
      "outputs": [],
      "execution_count": 11,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "print(X_train.shape)\n",
        "print(Y_train.shape)\n",
        "print(X_test.shape)\n",
        "print(Y_test.shape)"
      ],
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "(2265, 1)\n",
            "(2265, 1)\n",
            "(755, 1)\n",
            "(755, 1)\n"
          ]
        }
      ],
      "execution_count": 12,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Visualising the Training results\n",
        "plt.scatter(X_train, Y_train, color = 'red')\n",
        "plt.plot(X_train, regressor.predict(X_train), color ='blue')"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 13,
          "data": {
            "text/plain": [
              "[<matplotlib.lines.Line2D at 0x1691aacacc0>]"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 432x288 with 1 Axes>"
            ],
            "image/png": [
              "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD9CAYAAACsq4z3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0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AFxGpEgp0EZEqoUAXEakSCnQRkSqhQBcRqRL/H6p5zfV9Cm9SAAAAAElFTkSuQmCC\n"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 13,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "regressor.score(X_train, Y_train)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 14,
          "data": {
            "text/plain": [
              "0.99860918874125126"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 14,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# Visualizing the test results\n",
        "plt.scatter(X_test, Y_test, color = 'red')\n",
        "plt.plot(X_test, regressor.predict(X_test), color ='blue')"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 15,
          "data": {
            "text/plain": [
              "[<matplotlib.lines.Line2D at 0x1691ac17c18>]"
            ]
          },
          "metadata": {}
        },
        {
          "output_type": "display_data",
          "data": {
            "text/plain": [
              "<Figure size 432x288 with 1 Axes>"
            ],
            "image/png": [
              "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3Xl4XVW9//H3N+mYttg2DVBSmgAyFX5QMEARkWILP0QUUVEglWq5FBq4Vn48XpQKFqSI/rgIIq0EGVo4MlzKKCCWyQpCIZWhlIogNqEDNJ3oSKd87x/7nJOc5Jyck+HkTJ/X8/RJ1s7eO4vn0A+L715rbXN3REQk9xVlugMiItI9FOgiInlCgS4ikicU6CIieUKBLiKSJxToIiJ5QoEuIpInFOgiInlCgS4ikid69eQvGzZsmFdWVvbkrxQRyXkL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A7hnuT2dcbGZvhUsyWVmuaM3MKoEjgAXk4GfQqv+QQ5+BmRWb2RvAKmAe8C9gvbvvDJ+yjBz7D1UyCvTUHOfuRwJfBi4KlwSkZ80C9gNGAyuB/85sd5Izs4HAXOCH7r4h0/3pqDj9z6nPwN13uftoYARwNHBwvNN6tlfppUBPgbuvCH9dBTxM8C9Hrvk4XBuN1EhXZbg/HeLuH4f/gjYBt5Hln0G4bjsXCLn7Q+HDOfMZxOt/rn0GEe6+HngBGAMMNrPIm9pGACsy1a90UKAnYWYDwg+GMLMBwMnA2+1flZUeAyaGv58IPJrBvnRYJAjDziCLP4PwA7nbgSXufkOLH+XEZ5Co/zn2GZSZ2eDw9/2B8QTPAp4HvhU+LWs/g87SLJckzGxfglE5BO9g/YO7z8hgl5Iys3uBsQS7y30M/Ax4BHgAGAk0AGe6e1Y+eEzQ/7EE/6vvwFLggkg9OtuY2ReAvwKLgKbw4csJ6tBZ/xm00/+zyZ3P4DCCh57FBAPXB9z96vDf5/uAocDrwAR335a5nnYvBbqISJ5QyUVEJE8o0EVE8oQCXUQkTyjQRUTyhAJdRCRPKNBFRPKEAl1EJE8o0EVE8sT/AlHET5HvLSZaAAAAAElFTkSuQmCC\n"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 15,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# score measure the proportion of correctly classified instances\n",
        "regressor.score(X_test, Y_test)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 16,
          "data": {
            "text/plain": [
              "0.99842136537629844"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 16,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "# coefficient is a constant by which a variable is multiplied\n",
        "regressor.coef_"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 17,
          "data": {
            "text/plain": [
              "array([[ 0.97711376]])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 17,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    },
    {
      "cell_type": "code",
      "source": [
        "regressor.intercept_"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "execution_count": 18,
          "data": {
            "text/plain": [
              "array([ 0.00849281])"
            ]
          },
          "metadata": {}
        }
      ],
      "execution_count": 18,
      "metadata": {
        "collapsed": false,
        "outputHidden": false,
        "inputHidden": false
      }
    }
  ],
  "metadata": {
    "kernel_info": {
      "name": "python3"
    },
    "language_info": {
      "pygments_lexer": "ipython3",
      "name": "python",
      "mimetype": "text/x-python",
      "file_extension": ".py",
      "nbconvert_exporter": "python",
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "version": "3.5.5"
    },
    "kernelspec": {
      "name": "python3",
      "language": "python",
      "display_name": "Python 3"
    },
    "nteract": {
      "version": "0.14.5"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}